<!DOCTYPE html>
<html lang="en" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5"
      xmlns:th="http://www.thymeleaf.org">
<!--头部导航栏-->
<nav class="navbar navbar-inverse navbar-fixed-top" th:fragment="topbar">
    <div class="container-fluid">
        <div class="navbar-header">
            <button aria-controls="navbar" aria-expanded="false"
                    class="navbar-toggle collapsed" data-target="#navbar" data-toggle="collapse"
                    type="button">
                <span class="sr-only"></span> <span class="icon-bar"></span> <span
                    class="icon-bar"></span> <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">
                欢迎！<span sec:authentication="name"></span>
                <!-- 2.2.1不支持    最低支持2.0.9 -->
                <!-- 		  权限<span sec:authentication="principal.authorities"></span> -->
            </a>
        </div>
        <div class="navbar-collapse collapse" id="navbar">
            <ul class="nav navbar-nav navbar-right">
                <li><a th:href="@{/}">主页</a></li>

                <!--如果未登录，显示登录  -->
                <li sec:authorize="!isAuthenticated()">
                    <a th:href="@{/tologin}">登录</a></li>

                <!--如果登录，显示注销 -->
                <li sec:authorize="isAuthenticated()">
                    <a th:href="@{/logout}">注销</a></li>

            </ul>
            <form class="navbar-form navbar-right">
                <input class="form-control" placeholder="搜索" type="text">
            </form>
        </div>
    </div>
</nav>

<!--侧边栏-->
<div class="col-sm-3 col-md-2 sidebar" th:fragment="sidebar">
    <ul class="nav nav-sidebar">
        <li th:class="${active == 'main.html' ? 'active' : ''}"><a
                th:href="@{/index}">主页</a></li>
        <li th:class="${active == 'list.html' ? 'active' : ''}"><a
                th:href="@{/emps}">列表</a></li>
        <li th:class="${active == 'main1.html' ? 'active' : ''}"><a
                href="#">使用者</a></li>
        <li th:class="${active == 'main2.html' ? 'active' : ''}"><a
                th:href="@{/user/findAll}">使用者</a></li>
    </ul>
</div>


</html>